// 引入React 引入路由模块
import React from "react";
import { useRoutes } from "react-router-dom";

// 引入页面
import Login from "../views/login/login";
import Home from "../views/home/home";
import Map from "../views/map/map";
import Test from "../views/test/test1";

// 二级页
import Nav1 from "../views/home/aside/nav1";
import Nav2 from "../views/home/aside/nav2";
import Nav3 from "../views/home/aside/nav3";

// 创建路由
export default function Router() {
  // 路由表
  const routes = [
    { path: "/", element: <Login /> },
    {
      path: "/home",
      element: <Home />,
      children: [
        { path: "/home/nav1", element: <Nav1 /> },
        { path: "/home/nav2", element: <Nav2 /> },
        { path: "/home/nav3", element: <Nav3 /> },
      ],
    },
    { path: "/map", element: <Map /> },
    { path: "/test1", element: <Test /> },
  ];
  return useRoutes(routes);
}
